<script lang="ts" setup>
withDefaults(defineProps<{
  /** 长宽比例（默认1） */
  ratio: number
}>(), {
  ratio: 1,
})
</script>

<template>
  <view class="relative">
    <view
      class="relative w-full" :style="{
        paddingBottom: `${1 / ratio * 100}%`,
      }"
    ></view>
    <view class="absolute top-0 h-full w-full">
      <slot></slot>
    </view>
  </view>
</template>

<style lang="less" scoped></style>
